package com.atung.parking.mapper;

import com.atung.parking.entity.BusSuperUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

/**
 * @author Administrator
 */
@Mapper
public interface BusSuperUserMapper extends BaseMapper<BusSuperUser> {

    @Insert("INSERT INTO `bus_super_user` (id, username, password, status, name, phone, type, salt, descr, creator_id, modifier_id, modifier_time, creator_time, creator_name, modifier_name) " +
            "VALUES (#{busSuperUser.id}, #{busSuperUser.username}, #{busSuperUser.password}, #{busSuperUser.status}, #{busSuperUser.name}, " +
            "#{busSuperUser.phone}, #{busSuperUser.type}, #{busSuperUser.salt}, #{busSuperUser.descr}, #{busSuperUser.creatorId}, #{busSuperUser.modifierId}, " +
            "#{busSuperUser.modifierTime}, #{busSuperUser.creatorTime}, #{busSuperUser.creatorName}, #{busSuperUser.modifierName})"
    )
    @Options(useGeneratedKeys = true, keyProperty = "busSuperUser.id")
    int save(@Param("busSuperUser") BusSuperUser busSuperUser);

    @Select("SELECT name FROM bus_super_user WHERE id = #{id}")
    String queryNameById(Long superUserId);
}
